home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / wownt16.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  4.5 KB  |  141 lines

  1. /*++ BUILD Version: 0001    // Increment this if a change has global effects
  2.  
  3. Copyright (c) 1995-1996, Microsoft Corporation
  4.  
  5. Module Name:
  6.  
  7.     wownt16.h
  8.  
  9. Abstract:
  10.  
  11.     Procedure declarations for functions in WOW32.DLL callable by
  12.     3rd-party 16-bit thunking code.
  13.  
  14. --*/
  15.  
  16. /*
  17.  *      C/C++ Run Time Library - Version 9.0
  18.  *
  19.  *      Copyright (c) 1997, 1998 by Borland International
  20.  *      All Rights Reserved.
  21.  *
  22.  */
  23.  
  24. #ifndef _WOWNT16_
  25. #define _WOWNT16_
  26. #pragma option push -b
  27.  
  28.  
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32.  
  33. //
  34. // 16:16 -> 0:32 Pointer translation.
  35. //
  36. // GetVDMPointer32W will convert the passed in 16-bit address
  37. // to the equivalent 32-bit flat pointer. The upper 16 bits
  38. // of the address are treated according to the value passed in
  39. // fMode: if fMode = 1, then the hiword of vp is used as a
  40. // protected mode selector. Otherwise it is used as a real mode
  41. // segment value.
  42. // The lower 16 bits are treated as the offset.
  43. //
  44. // The return value is 0 if the selector is invalid.
  45. //
  46. // NOTE:  Limit checking is not performed in the retail build
  47. // of Windows NT.  It is performed in the checked (debug) build
  48. // of WOW32.DLL, which will cause 0 to be returned when the
  49. // limit is exceeded by the supplied offset.
  50. //
  51.  
  52. DWORD FAR PASCAL GetVDMPointer32W(LPVOID vp, UINT fMode);
  53.  
  54.  
  55. //
  56. // Win32 module management.
  57. //
  58. // The following routines accept parameters that correspond directly
  59. // to the respective Win32 API function calls that they invoke. Refer
  60. // to the Win32 reference documentation for more detail.
  61.  
  62. DWORD FAR PASCAL LoadLibraryEx32W(LPCSTR lpszLibFile, DWORD hFile, DWORD dwFlags);
  63. DWORD FAR PASCAL GetProcAddress32W(DWORD hModule, LPCSTR lpszProc);
  64. DWORD FAR PASCAL FreeLibrary32W(DWORD hLibModule);
  65.  
  66. //
  67. // Generic Thunk Routine:
  68. //
  69. //   CallProc32W
  70. //
  71. // Transitions to 32 bits and calls specified routine
  72. //
  73. // This routine can pass a variable number of arguments, up to 32, to the
  74. // target 32-bit routine. These arguments are given to CallProc32W following
  75. // the 3 required parameters.
  76. //
  77. //   DWORD cParams          - Number of optional DWORD parameters (0-32)
  78. //
  79. //   LPVOID fAddressConvert - Bit Field, for 16:16 address Convertion. The
  80. //                            optional parameters can be automatically converted
  81. //                            from a 16:16 address format to flat by specifying
  82. //                            a 1 bit in the corresponding position in this mask.
  83. //                            eg (bit 1 means convert parameter 1 from 16:16
  84. //                              to flat address before calling routine)
  85. //
  86. //   DWORD lpProcAddress   -  32 bit native address to call (use LoadLibraryEx32W
  87. //                            and GetProcAddress32W to get this address).
  88. //
  89. // Returns:
  90. //   What ever the API returned on 32 bit side in AX:DX
  91. //
  92. // Error Returns:
  93. //   AX = 0, more than 32 parameters.
  94. //
  95. //
  96. // The function prototype must be declared by the application source code
  97. // in the following format:
  98. //
  99. // DWORD FAR PASCAL CallProc32W( DWORD p1, ... , DWORD lpProcAddress,
  100. //                                        DWORD fAddressConvert, DWORD cParams);
  101. //
  102. // where the value in cParams must match the actual number of optional
  103. // parameters (p1-pn) given AND the "DWORD p1, ..." must be replaced by
  104. // the correct number of parameters being passed.  For example, passing 3
  105. // parameter would simply require the removal of the ... and it insertion of
  106. // "DWORD p2, DWORD p3" instead.  The fAddressConvert parameter uses bit 1
  107. // for the last parameter (p3 in our example), with bit 2 for the next to last,
  108. // etc.
  109. //
  110. // Generic Thunk Routine:
  111. //
  112. //   CallProcEx32W
  113. //
  114. // Transitions to 32 bits and calls specified routine
  115. //
  116. // Similar to the CallProc32W function, the CallProcEx32W is an equivalent
  117. // function that is C calling convention and allows easier and more flexible
  118. // prototyping.  See the prototype below.  The fAddressConvert parameter uses
  119. // bit 1 for the 1st parameter, bit 2 for the 2nd parameter, etc.
  120. //
  121. // Both CallProc32W and CallProcEx32W accept a flag OR'd with the parameter
  122. // count to indicate the calling convention of the function in 32 bits.
  123. // For example, to call a cdecl function in 32-bits with 1 parameter, it would
  124. // look like this:
  125. //
  126. // dwResult = CallProcEx32W( CPEX_DEST_CDECL | 1, 0, dwfn32, p1 );
  127. //
  128.  
  129. DWORD FAR CDECL CallProcEx32W( DWORD, DWORD, DWORD, ... );
  130.  
  131. #define CPEX_DEST_STDCALL   0x00000000L
  132. #define CPEX_DEST_CDECL     0x80000000L
  133.  
  134. #ifdef __cplusplus
  135. }
  136. #endif
  137.  
  138.  
  139. #pragma option pop
  140. #endif /* !_WOWNT16_ */
  141.